﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WLFramework.Web;
using WLFramework.Web.Binder;

namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        public class Model
        {
            [WLFramework.Validation.Display("用户名")]
            [WLFramework.Validation.Required]
            public string LoginName;

            [WLFramework.Validation.Required]
            public string Password;

            [WLFramework.Validation.Required]
            public DateTime Birthday;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                Model model;
                var errors = this.Context.GetModel<Model>(out model);
                if (errors.Count > 0) 
                {
                    this.Context.AlertErrorMessage(errors[0].Message);
                }
            }
        }
    }
}